package com.laoyang.rabbit.sercer;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.TimerTask;
import java.util.concurrent.*;

/**
 * @author com.yyy
 * @Date 2020-09-12 9:19
 * @Email yangyouyuhd@163.com
 */
@Service
public class MqService implements Delayed {

    @Resource
    RabbitTemplate rabbitTemplate;

    public void test(Channel channel){
        Message message = new Message("".getBytes(),null);
        rabbitTemplate.send(message);
        Message receive = rabbitTemplate.sendAndReceive(message);
        rabbitTemplate.convertAndSend(message);

        // 延时队列、
        DelayQueue<MqService> delayQueue = new DelayQueue<MqService>();

        // 延时队列
        ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(5);
//        scheduledExecutorService.scheduleAtFixedRate()
//        scheduledExecutorServi
//        HashedWheelTime
//        new TimerTask()
//        ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();

    }

    @Override
    public long getDelay(TimeUnit timeUnit) {
        return 0;
    }

    @Override
    public int compareTo(Delayed delayed) {
        return 0;
    }
}
